//
//  YJSplitViewController.m
//  宜居HD
//
//  Created by 张金国 on 16/5/2.
//  Copyright © 2016年 张金国. All rights reserved.
//

#import "YJSplitViewController.h"
#import "Macro.h"
#import "MasterViewController.h"
#import "DetailViewController.h"
#import "Dock.h"
#import "Masonry.h"

#import "PersonCenterViewController.h"
#import "UserManageViewController.h"
#import "DiscussViewController.h"
#import "HouseTypeInfoViewController.h"
#import "ChatOnlineViewController.h"
#import "SandboxViewController.h"
#import "SettingViewController.h"
#import "SettingDetailNavController.h"
@implementation YJSplitViewController

#pragma mark - init
- (instancetype)init {
    if (self = [super init]) {
        MasterViewController * masterViewController = [[MasterViewController alloc]init];
        DetailViewController * detailViewController = [[DetailViewController alloc]init];
        
        __weak typeof(self) weakSelf = self;
        masterViewController.block = ^(NSString* controllerName){
            NSMutableArray *array = [NSMutableArray arrayWithArray:weakSelf.viewControllers];
            Class clazz = NSClassFromString(controllerName);
            UIViewController *controller = [clazz new];
            SettingDetailNavController *nav = [[SettingDetailNavController alloc] initWithRootViewController:controller];
            //给户型房源添加导航栏
            if ([controllerName isEqualToString:@"HouseTypeInfoViewController"]) {
                array[1] = nav;
            } else {
                array[1] = controller;
            }
            
            weakSelf.viewControllers = array;
        };
        self.viewControllers = @[masterViewController,detailViewController];
        self.maximumPrimaryColumnWidth=0.087*[UIScreen mainScreen].bounds.size.width;
           }
    return self;
}

#pragma mark - LifeCircle
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = kDockBackgroundColor;
    self.view.frame = CGRectMake(0, 20, SCREEN_WIDTH-20, SCREEN_HEIGHT-30);
    
}





@end
